package com.bimiaomiao.sentinel.sku.web;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.fastjson.JSON;
import com.bimiaomiao.sentinel.sku.service.SkuService;
import com.bimiaomiao.sentinel.sku.vo.SkuVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

/**
 * @description:商品服务
 * @package com.bimiaomiao.sentinel.sku
 * @who MiaoMiao "Sprout" BI
 * @date 2021-03-02 13:32:29
 */
@RestController
@RequestMapping("/sku")
public class SkuController {

    @Autowired
    private SkuService skuService;
//    @SentinelResource("info")
    @GetMapping("/info")
    public String info()
    {
        String infos = skuService.info();
//        ArrayList<SkuVo> skuVos = new ArrayList<>();
//        skuVos.add(new SkuVo(100001, "测试商品001", "9238924292"));
//        skuVos.add(new SkuVo(100002, "戴尔电脑", "9238924293"));
//        skuVos.add(new SkuVo(100003, "小米手机", "9238924294"));
        return JSON.toJSONString(infos);
    }
}
